package cn.laixueit.myexception;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@RestControllerAdvice
public class MyException {

    @ExceptionHandler(value = RuntimeException.class)
    public String a(Model model, HttpServletRequest request){
        request.setAttribute("msg","as");
        return "b";
    }

    @ExceptionHandler(value = IOException.class)
    public String b(){
        return "b";
    }

    @ExceptionHandler(value = ClassCastException.class)
    public String c(){
        return "b";
    }
}
